package i18n;

import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.ResourceBundle;

public class I18n {
	public static void display(){
		Locale[] locales = Locale.getAvailableLocales();
		for (Locale locale : locales) {
			System.out.println(locale.getDisplayCountry() + "="
					+ locale.getCountry() + "  " + locale.getDisplayLanguage()
					+ "=" + locale.getLanguage());
		}
	}
	public static void msgFormat(){
		Locale myLocale=Locale.getDefault();
		ResourceBundle bundle=ResourceBundle.getBundle("i18n/msg", myLocale);
		String msg=bundle.getString("msg");
		
		msg=MessageFormat.format(msg, "天",getDate());
		System.out.println(msg);
	}
	public static String getDate(){
		SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date date=new Date();
		String result=format.format(date);
		return result;
	}
	public static void main(String[] args) {
		msgFormat();
	}
}
